import React from 'react';
import { Switch, Route, event } from '@pare/micro';
import { Error, Lazy, LazyLoad } from '@pare/common';

const homeCom = () => import(`@/app/containers/home/index`);
import demo from 'bundle-loader?lazy&name=demo!@/app/containers/home/index/index';
import demo3 from '@/app/containers/home/index.bundle';
//注册全局数据
event.emit('data', {});

const RoutesComponent = () => (
  <Switch>
    <Route path="/" exact strict component={Lazy(homeCom, '首页')} />
    <Route path="/demo1" component={LazyLoad(demo, 'Demo1')} />
    <Route path="/demo2" host="http://127.0.0.1:3002" />
    <Route path="/demo3" exact strict component={LazyLoad(demo3, 'Demo3')} />
    <Route component={Error} />
  </Switch>
);

export default RoutesComponent;
